<?php
		require './init.php';
//		$sql = 'select * from stu';
		$sql = 'select a.id,a.stu_num,a.name,a.sex,a.qq,a.phone,a.homepage,a.birthday, b.class_name from stu a inner join class b on a.cid = b.id';
		$result = mysql_query($sql);
		while($row = mysql_fetch_assoc($result)){
//			var_dump($row);
			$list[] = $row;
		}
?>

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>首页--《学生信息管理系统》</title>
    <link href="./static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
	  <link rel="stylesheet" type="text/css" href="./static/css/style.css"/>
  </head>
  <body>
  	<!--头部-->
  	<div class="header">
	    <div class="jumbotron">
		  <h1>学生信息管理系统</h1>
		</div>
  	</div>
  	<!--列表展示-->
		<div class="list container">
			<div class="page-heade">
				<form class="navbar-form navbar-right">
			        <div class="form-group">
			          <input type="text" class="form-control" placeholder="Search">
			        </div>
			        <button type="submit" class="btn btn-default">搜索</button>
			    </form>
			</div>
			<table class="table table-bordered table-condensed table-hover">
			  <thead>
			  	<th>ID</th>
			  	<th>学号</th>
			  	<th>姓名</th>
			  	<th>性别</th>
			  	<th>班级 <i class="glyphicon glyphicon-arrow-up"></i></th>
			  	<th>QQ</th>
			  	<th>电话</th>
			  	<th>个人主页</th>
			  	<th>出生日期<i class="glyphicon glyphicon-arrow-down"></th>
			  	<th>操作</th>
			  </thead>
			  <tbody>
			  	<?php foreach($list as $item){?>
			  	<tr>
			  		<td><?php echo $item['id']; ?></td>
			  		<td><?php echo $item['stu_num']; ?></td>
			  		<td><?php echo $item['name']; ?></td>
			  		<td><?php echo $item['sex']; ?></td>
			  		<td><?php echo $item['class_name']; ?></td>
			  		<td><?php echo $item['qq']; ?></td>
			  		<td><?php echo $item['phone']; ?></td>
			  		<td><a href=""><?php echo $item['homepage']; ?></a></td>
			  		<td><?php echo $item['birthday']; ?></td>
			  		<td>
			  			<a href="./detail.php?id=<?php echo $item['id']; ?>" class="btn btn-primary btn-sm">查看</a>
			  		</td>
			  	</tr>
			  	<?php }?>
			  </tbody>
			</table>
			
			<!--分页-->
			<nav aria-label="Page navigation">
			  <ul class="pagination pull-right">
			    <li>
			      <a href="#" aria-label="Previous">
			        <span aria-hidden="true">&laquo;</span>
			      </a>
			    </li>
			    <li><a href="#">1</a></li>
			    <li><a href="#">2</a></li>
			    <li><a href="#">3</a></li>
			    <li><a href="#">4</a></li>
			    <li><a href="#">5</a></li>
			    <li>
			      <a href="#" aria-label="Next">
			        <span aria-hidden="true">&raquo;</span>
			      </a>
			    </li>
			  </ul>
			</nav>
		</div>
		<!--底部-->
		<footer>
			<p>
				<a href="./index.html" class="btn btn-xs btn-success">首页</a>
				<a href="./photowall.html" class="btn btn-xs btn-success">照片墙</a>
				<button  class="btn btn-xs btn-success" data-toggle="modal" data-target="#login">登录</button>
			</p>
			<p>大涛课堂——《学生信息管理系统》</p>
		</footer>
	
	
		<!-- Modal 登录-->
		<div class="modal fade" id="login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		  <div class="modal-dialog modal-sm" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="myModalLabel">登录</h4>
		      </div>
		      <div class="modal-body">
		        <form class="form-horizontal">
				  <div class="form-group">
				    <div class="col-sm-offset-1 col-sm-12">
				      <input type="text" class="form-control" id="inputEmail3" placeholder="用户名">
				    </div>
				  </div>
				  <div class="form-group">
				    <div class="col-sm-offset-1 col-sm-12">
				      <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
				    </div>
				  </div>
				  <div class="form-group">
				    <div class="col-sm-offset-1">
				    	<div class="col-sm-6">
				    		<input type="text" class="form-control" id="inputPassword3" placeholder="验证码" size="8">
				    	</div>
				    	<div class="col-sm-6">
				    		<img src="img/yan.png"/>
				    	</div>
				    </div>
				      
				  </div>
				  <div class="form-group">
				    <div class="col-sm-offset-4 col-sm-12">
				      <button type="submit" class="btn btn-default">登录</button>
				    </div>
				  </div>
				</form>
		      </div>
		    </div>
		  </div>
		</div>
	
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="./static/lib/bootstrap/js/bootstrap.js"></script>
  </body>
</html>
